package org.xg.security;

import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.security.authentication.encoding.PasswordEncoder;

/**
 * 采用Md5PasswordEncoder
 * @author xg
 *
 */
public class PasswordEncryService  extends Md5PasswordEncoder implements PasswordEncoder {

	public static final String INIT_PSW = "123456";
	
	public static void main(String[] args) {
		final String encodePassword = new Md5PasswordEncoder().encodePassword("123456", null);
		System.out.println(encodePassword);
	}
	
	@Override
	public String encodePassword(String rawPass, Object salt) {
		//return super.encodePassword(rawPass, salt);
		return rawPass;
	}
	
	@Override
	public boolean isPasswordValid(String encPass, String rawPass, Object salt) {
//		boolean b = super.isPasswordValid(encPass, rawPass, salt) ;
		boolean b = false;
		if( encPass!=null && encPass.equals(rawPass) ){
			b = true;
		}
		return b;
	}

}
